package rmaqlc31.basic;

public class J14_ExtendClass {

	public static void main(String[] args) {
		// 객체지향 특성 : 상속
		J14SungJuk sj = new J14SungJuk("지현", 99, 78, 55);
		System.out.println(sj.getTotal());
		J14SungJukExtend sje = new J14SungJukExtend("지현", 99, 78, 55, 34, 12);
		System.out.println(sje.getTotal());
		
		
	} // main

} // class

class J14SungJuk {
	private String name;
	private int kor;
	private int eng;
	private int mat;
	
	public int getTotal(){
		return kor+eng+mat;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getKor() {
		return kor;
	}

	public void setKor(int kor) {
		this.kor = kor;
	}

	public int getEng() {
		return eng;
	}

	public void setEng(int eng) {
		this.eng = eng;
	}

	public int getMat() {
		return mat;
	}

	public void setMat(int mat) {
		this.mat = mat;
	}

	public J14SungJuk(String name, int kor, int eng, int mat) {
		super();
		this.name = name;
		this.kor = kor;
		this.eng = eng;
		this.mat = mat;
	}
	
	
}

class J14SungJuk2 {
	private String name;
	private int kor;
	private int eng;
	private int mat;
	private int soc;
	private int art;
	
	public int getTotal(){
		return kor+eng+mat+soc+art;
	}
}

class J14SungJukExtend extends J14SungJuk{
	private int soc;
	private int art;
	
	@Override
	public int getTotal() {
		// return kor+eng+mat+soc+art;
		return super.getTotal()+soc+art;
		// super는 상속관계에서 부모클래스를 의미
		// 따라서, J14SungJuk 클래스의
		// getTotal 메서드를 가리킴
	}

	public int getSoc() {
		return soc;
	}

	public void setSoc(int soc) {
		this.soc = soc;
	}

	public int getArt() {
		return art;
	}

	public void setArt(int art) {
		this.art = art;
	}

	public J14SungJukExtend(String name, int kor, int eng, int mat, int soc,
			int art) {
		super(name, kor, eng, mat);
		// super() 는 상속관계에서
		// 부모클래스의 생성자를 의미함
		// 따라서, super()는 J14SungJuk의
		// J14SungJuk(name, kor, eng, mat)를 가리킴
		this.soc = soc;
		this.art = art;
	}
	
	
}

















